#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

vector<int> advantageCount(vector<int>& nums1, vector<int>& nums2) {
    vector<int> index2(nums2.size());
    for (int i = 0; i < nums2.size(); i++) index2[i] = i;
    sort(nums1.begin(), nums1.end(), less<int>());
    sort(index2.begin(), index2.end(), [&](int i, int j) {
        return nums2[i] < nums2[j];
        });
    int left = 0, right = index2.size() - 1;
    vector<int> ret(nums1.size());
    for (auto x : nums1)
    {
        if (x > nums2[index2[left]])
        {
            ret[index2[left]] = x;
            ++left;
        }
        else
        {
            ret[index2[right]] = x;
            right--;
        }
    }
    return ret;
}

int longestPalindrome(string s) {
    int arr[123] = { 0 };
    for (auto x : s)
    {
        arr[x]++;
    }
    int ret = 0;
    for (int i = 0; i < 123; i++)
    {
        if (arr[i] != 0)
            ret += arr[i] / 2 * 2;
    }
    if (ret != s.size()) ret++;
    return ret;
}


vector<int> diStringMatch(string s) {
    vector<int> ret;
    int max = s.size(), min = 0;
    for (auto x : s)
    {
        if (x == 'I') ret.push_back(min++);
        else ret.push_back(max--);
    }
    ret.push_back(min);
    return ret;
}

int main()
{
    vector<int> nums1{ 12,24,8,32 };
    vector<int> nums2{ 13,25,32,11 };

    //advantageCount(nums1, nums2);

    string s("abccccdd");
    //longestPalindrome(s);
    diStringMatch("IDID");
    int a[123] = { 0 };
    //cout << 'A' - 'A' + 26;
    for (auto x : s) a[x]++;

	return 0;
}